# -*- coding: utf-8 -*-
# @Time: 2022/4/29 14:07
# @Author: 发抖的小喵喵
# @Email: panyi_20210601@163.com
# @File: Get.py
# @Project: haixin
# @Software: PyCharm


import requests
import json

from test_case.haixin.getSign import GetSign



def get_method(data, url):
    getSign = GetSign(data)
    ls = getSign.sign()

    headers = {
        "appId": "1a748b70d0cb4a8a8e37e959f4a4f1e6",
        "timestamp":  ls[2],
        "randNum": ls[3],
        "sign": ls[0]
        # "Content-Type": "application/json; charset=utf-8"
    }

    # param = []
    # for i in data.items():
    #     param.append("=".join(i))
    # params = "&".join(param)

    # req = requests.get(url + "?" + params, headers=headers, data=ls[1])
    req = requests.get(url=url, headers=headers, params=data, data=ls[1])  # 因参数加过密需将参数一起请求
    res = req.json()
    # print(req.url)
    return res
